package com.ztz.dao;

import com.ztz.execl.ReadExcel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import pers.lt.jdbc.JdbcTemplate;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Component("TestDao")
public class TestDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public boolean insertUser(StringBuffer str)  {
        StringBuffer strs=new StringBuffer();
        String uuid= UUID.randomUUID().toString().replaceAll("-","");

        strs.append("insert into mtpts.queryimport values("+"'"+uuid+"'"+"");

        for(int i=0;i<str.length();i++){
            strs.append(str.toString().toCharArray()[i]);
        }
        //strs.append(""+"'"+repetition+"'");
        strs.append(""+")");
        boolean ret = false;
        try {
            try {
                System.out.println(strs);
                ret = jdbcTemplate.excuteSql(strs.toString());
            } catch (SQLException e) {
                e.printStackTrace();
            }
        } catch (DataAccessException e) {
            e.printStackTrace();
        }
        return ret;
    }
}
